package colibri.keyboard;

import colibri.App;

/**
 *
 * @author Bayron Thiengo Quinelato
 */
public class Qwerty {
    
    public static char getCharacter(int key) {
        return (char)key;
    }
    
    public static char getNumericInteger(int keyCode) {
        switch (App.platform) {
            case App.PLATFORM_BLACKBERRY:
                switch (keyCode) {
                    case 87:
                    case 119:
                        return '1';
                    case 69:
                    case 101:
                        return '2';
                    case 82:
                    case 114:
                        return '3';
                    case 83:
                    case 115:
                        return '4';
                    case 68:
                    case 100:
                        return '5';
                    case 70:
                    case 102:
                        return '6';
                    case 90:
                    case 122:
                        return '7';
                    case 88:
                    case 120:
                        return '8';
                    case 67:
                    case 99:
                        return '9';
                    default:
                        return 'X';
                }
            case App.PLATFORM_J2ME:
            default:
                    if (keyCode >= 48 && keyCode <= 57) {
                        return (char)keyCode;
                    }
                    return 'X';
        }
    }
    
    public static char getNumericFloat(int keyCode) {
        switch(keyCode){
            case 44:
            case 78:
            case 110:
            case 46:
            case 77:
            case 109:
                return '.';
            case 45:
            case 73:
            case 105:
                return '-';
            default:
                return getNumericInteger(keyCode);
        }
    }

}
